package com.intelligent.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 付款单信息表
 * @TableName payment_order
 */
@TableName(value ="payment_order")
@Data
public class PaymentOrder implements Serializable {
    /**
     * 自增主键
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 付款单号
     */
    @TableField("payment_order_no")
    private String paymentOrderNo;

    /**
     * 付款状态（0 待核销、1 部分核销、2 全部核销等）
     */
    @TableField("payment_status")
    private Integer paymentStatus;

    /**
     * 付款类型（0 委外付款、1 采购付款、2 其他付款等）
     */
    @TableField("payment_type")
    private String paymentType;

    /**
     * 客户信息（名称 + 编码）
     */
    @TableField("customer_id")
    private Integer customerId;

    /**
     * 关联销售单
     */
    @TableField("related_sales_order")
    private String relatedSalesOrder;

    /**
     * 应付总额
     */
    @TableField("payable_amount")
    private BigDecimal payableAmount;

    /**
     * 已核销金额
     */
    @TableField("written_off_amount")
    private BigDecimal writtenOffAmount;

    /**
     * 待核销金额
     */
    // @TableField("amount_written_off")
    // private BigDecimal amountWrittenOff;

    /**
     * 财务人员
     */
    @TableField("u_id")
    private Long uId;

    /**
     * 创建日期
     */
    @TableField("creation_date")
    private Date creationDate;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        PaymentOrder other = (PaymentOrder) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getPaymentOrderNo() == null ? other.getPaymentOrderNo() == null : this.getPaymentOrderNo().equals(other.getPaymentOrderNo()))
            && (this.getPaymentStatus() == null ? other.getPaymentStatus() == null : this.getPaymentStatus().equals(other.getPaymentStatus()))
            && (this.getPaymentType() == null ? other.getPaymentType() == null : this.getPaymentType().equals(other.getPaymentType()))
            && (this.getCustomerId() == null ? other.getCustomerId() == null : this.getCustomerId().equals(other.getCustomerId()))
            && (this.getRelatedSalesOrder() == null ? other.getRelatedSalesOrder() == null : this.getRelatedSalesOrder().equals(other.getRelatedSalesOrder()))
            && (this.getPayableAmount() == null ? other.getPayableAmount() == null : this.getPayableAmount().equals(other.getPayableAmount()))
            && (this.getWrittenOffAmount() == null ? other.getWrittenOffAmount() == null : this.getWrittenOffAmount().equals(other.getWrittenOffAmount()))
            // && (this.getAmountWrittenOff() == null ? other.getAmountWrittenOff() == null : this.getAmountWrittenOff().equals(other.getAmountWrittenOff()))
            && (this.getUId() == null ? other.getUId() == null : this.getUId().equals(other.getUId()))
            && (this.getCreationDate() == null ? other.getCreationDate() == null : this.getCreationDate().equals(other.getCreationDate()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getPaymentOrderNo() == null) ? 0 : getPaymentOrderNo().hashCode());
        result = prime * result + ((getPaymentStatus() == null) ? 0 : getPaymentStatus().hashCode());
        result = prime * result + ((getPaymentType() == null) ? 0 : getPaymentType().hashCode());
        result = prime * result + ((getCustomerId() == null) ? 0 : getCustomerId().hashCode());
        result = prime * result + ((getRelatedSalesOrder() == null) ? 0 : getRelatedSalesOrder().hashCode());
        result = prime * result + ((getPayableAmount() == null) ? 0 : getPayableAmount().hashCode());
        result = prime * result + ((getWrittenOffAmount() == null) ? 0 : getWrittenOffAmount().hashCode());
        // result = prime * result + ((getAmountWrittenOff() == null) ? 0 : getAmountWrittenOff().hashCode());
        result = prime * result + ((getUId() == null) ? 0 : getUId().hashCode());
        result = prime * result + ((getCreationDate() == null) ? 0 : getCreationDate().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", paymentOrderNo=").append(paymentOrderNo);
        sb.append(", paymentStatus=").append(paymentStatus);
        sb.append(", paymentType=").append(paymentType);
        sb.append(", customerId=").append(customerId);
        sb.append(", relatedSalesOrder=").append(relatedSalesOrder);
        sb.append(", payableAmount=").append(payableAmount);
        sb.append(", writtenOffAmount=").append(writtenOffAmount);
        // sb.append(", amountWrittenOff=").append(amountWrittenOff);
        sb.append(", uId=").append(uId);
        sb.append(", creationDate=").append(creationDate);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}
